<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../lib/respond.min.js?rev=@@hash"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="../../../lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="../../../static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../../ht-css/Project.css"/>
    <link rel="stylesheet" type="text/css" href="../../../lib/Validform/5.3.2/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="../../../lib/DD_belatedPNG_0.0.8a-min.js?rev=@@hash"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../../ht-css/style-q.css"/>
    <title></title>
</head>
<body>
<form class="ml-20 mt-20 mb-20 mr-20" id="form-member-add">
    <div class="">
        <span class="select-box size-M radius mb-15" style="background: #fff">
        <select class="select" name="" id="reason">
            <option value="">选择取消原因</option>
        </select>
        </span>
    </div>
    <div  class="formControls mb-20">
        <textarea class="textarea radius" name="" id="" cols="30" rows="10" datatype="*1-500" onKeyUp="value=value.replace(/\s+/g,'')" ignore="ignore"></textarea>
    </div>
    <span class="Validform_checktip"></span>
    <div style="text-align: center">
        <a onclick="cancelBtn()" id="cancelBtn" class="btn btn-secondary radius size-S ml-20">取消</a>
        <input id="bottm" type="submit" class="btn btn-secondary radius size-S ml-20" value="确认">
    </div>
</form>
</body>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
<!--表单验证-->
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../lib/Validform/5.3.2/Validform_v5.3.2_min.js?rev=@@hash"></script>
<script src="../../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../../ht-js/Project.js?rev=@@hash"></script>
<script>
    $(function(){
        $("#form-member-add").Validform({
            tiptype:2,
            callback:function(form){
                sureBtn()
                return false;
            }
        });
    })
    var orderDetail = JSON.parse(sessionStorage.getItem("orderDetail"));

    function sureBtn() {
        var orderState = orderDetail.orderBase.order_status;
        switch (orderState){
            /*订单状态*/
            case 10:

                // return "待付款";
                break;
            case 20:

                // return "待审核";
                break;
            case 30:
                /*待配货*/
                $.ajax({
                    contentType:"application/json",
                    type: "POST",
                    url: root.orderInter.order_undistributed_cancleOrder,
                    cache: false,  //禁用缓存
                    dataType: "json",
                    data: JSON.stringify({
                        order_id: orderDetail.orderBase.order_id,
                        member_id: orderDetail.orderBase.member_id,
                        shop_id: orderDetail.orderBase.shop_id,
                        warehouse_id: orderDetail.orderBase.warehouse_id,
                        cancel_order_status: orderDetail.orderBase.order_status,
                        cancel_role: 20,
                        cancle_reason:10,
                        cancel_remark:"不想买了"
                    }),
                    success: function (result) {
                        console.log(result)
                        var index =  parent.location.reload();
                        parent.layer.close(index);
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        isIng = false;
                    }
                });
                break;
            case 40:
                /*"待出库";*/
                $.ajax({
                    contentType:"application/json",
                    type: "POST",
                    url: root.orderInter.order_unshipped_cancleOrder,
                    cache: false,  //禁用缓存
                    dataType: "json",
                    data: JSON.stringify({
                        order_id: orderDetail.orderBase.order_id,
                        member_id: orderDetail.orderBase.member_id,
                        shop_id: orderDetail.orderBase.shop_id,
                        warehouse_id: orderDetail.orderBase.warehouse_id,
                        cancel_order_status: orderDetail.orderBase.order_status,
                        cancel_role: 20,
                        cancle_reason:10,
                        cancel_remark:"待出库不想买了"
                    }),
                    success: function (result) {
                        console.log(result)
                        var index =  parent.location.reload();
                        parent.layer.close(index);
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        isIng = false;
                    }
                });
                break;
            case 50:
               /* "待发货";*/
                $.ajax({
                    contentType:"application/json",
                    type: "POST",
                    url: root.orderInter.order_undelievered_cancleOrder,
                    cache: false,  //禁用缓存
                    dataType: "json",
                    data: JSON.stringify({
                        order_id: orderDetail.orderBase.order_id,
                        member_id: orderDetail.orderBase.member_id,
                        shop_id: orderDetail.orderBase.shop_id,
                        warehouse_id: orderDetail.orderBase.warehouse_id,
                        cancel_order_status: orderDetail.orderBase.order_status,
                        cancel_role: 20,
                        cancle_reason:10,
                        cancel_remark:"待发货不想买了"
                    }),
                    success: function (result) {
                        console.log(result)
                        var index =  parent.location.reload();
                        parent.layer.close(index);
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(XMLHttpRequest);
                    }
                });
                break;
            case 60:

                // return "待收货";
                break;
            case 70:

                // return "已收货，待结算";
                break;
            case 80:

                // return "订单成功";
                break;
            case 90:

                // return "订单完成";
                break;
            case 100:

                // return "已取消";
                break;
            case 110:

                // return "交易关闭";
                break;
        }
    }
    function cancelBtn() {
        parent.layer.closeAll();
    }
</script>
</html>